package com.jk.service;


import com.jk.dao.XsjfDao;
import com.jk.entity.UserEntity;
import com.jk.entity.XsjfEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
public class XsjfService {
    @Autowired
    private XsjfDao xsjfDao;
    public List<XsjfEntity> getXsjf() {
        return xsjfDao.getXsjf();
    }

    public void UpdStatus(Integer id, HttpServletRequest request) {
        UserEntity user = (UserEntity) request.getSession().getAttribute("user");
        Integer uid = user.getId();
            xsjfDao.UpdStatus(id,uid);

    }

    public List<XsjfEntity> getMyxs(HttpServletRequest request) {
        UserEntity user = (UserEntity) request.getSession().getAttribute("user");
        Integer uid = user.getId();
        return xsjfDao.getMyxs(uid);
    }

    public void uStatus(Integer id, HttpServletRequest request) {
        xsjfDao.uStatus(id);
    }

    public List<XsjfEntity> getMyxsAdmin(HttpServletRequest request) {
        UserEntity user = (UserEntity) request.getSession().getAttribute("user");
        Integer adminid = user.getId();
        return xsjfDao.getMyxsAdmin(adminid);
    }

    public void AdminStatus(Integer id,Integer uid,Integer xsintegral) {
        xsjfDao.AdminStatus(id);
        xsjfDao.UpduIntegral(uid,xsintegral);
    }

    public void AdminStatus1(Integer id) {
        xsjfDao.AdminStatus1(id);
    }
}
